package com.yx.gifts;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.yx.gifts.bean.Gift;
import com.yx.gifts.customer.SendGiftView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private TextView showGifts;
    private SendGiftView sendGiftView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        showGifts = (TextView) findViewById(R.id.main_show_gift);
        sendGiftView = (SendGiftView) findViewById(R.id.send_giftview);

        showGifts.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DialogGift.showGift(MainActivity.this, "live_id", sendGiftView);
            }
        });
    }

    @Override
    protected void onResume() {
        super.onResume();
        //礼物导航
        String[] mTitle = {"礼物1", "礼物2", "礼物3"};
        DialogGift.mTitles = mTitle;
        //导航对应的组数据
        List<List<Gift>> dataLists = new ArrayList<>();
        List<Gift> L1 = new ArrayList<>();
        List<Gift> L2 = new ArrayList<>();
        List<Gift> L3 = new ArrayList<>();
        for (int i = 0; i < 16; i++) {
            Gift g1 = new Gift();
            g1.setId(i);
            g1.setGold("100");
            g1.setImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1551093420614&di=afe8359c1be346e3f4188dde8e6bf493&imgtype=0&src=http%3A%2F%2Fimg4.duitang.com%2Fuploads%2Fitem%2F201407%2F28%2F20140728211434_ETXch.jpeg");
            g1.setName("礼物" + i);
            L1.add(g1);
            L2.add(g1);
            L3.add(g1);
        }
        dataLists.add(L1);
        dataLists.add(L2);
        dataLists.add(L3);

        DialogGift.dataList = dataLists;
    }
}
